

import React, { Component } from 'react';
// import Son from "./Son"
import WithLazy from '../../../router/withLazy'
// Son：是模块的全局变量，此变量的执行时机是，只要引入当前模块，就会执行
const Son = WithLazy(()=>import("./Son"))

export default class index extends Component {
    constructor(props){
        super(props);
        this.state ={
            query:{
                name:"张三疯",
                minAge:12,
                maxAge:22
            }
        }
        console.log("父：constructor");
    }

    chuan(res){
      console.log("res",res);
      console.log("this",this);
  }

    componentWillMount(){
      console.log("父：componentWillMount");

    }

    componentDidMount(){
      console.log("父：componentDidMount");

    }

 
  render() {
    console.log("父：render");
    const {name,minAge} = this.state.query;
    return (
      <div>
        <h1>父组件(父子组件传值：props传递数据和props传递方法)</h1>
        <hr/>
        <Son name={name} minAge={minAge} chuan={this.chuan} ></Son>
      </div>
    )
  }
}